<?php
	define('CONFIG_FILE',true);
	include '../config.php';

	define('DB_FILE',true);
	require_once '../Tool/DB/SqlDBManager.class.php';

	session_start();

	$userType = $_SESSION["userType"];
	$centreName=$_SESSION['centreName'];

	$flag=0;

	if ($userType == "Centre Manager"){
		$sqlDBManager= new SqlDBManager();

		$today = date('Y-m-d');
		$sql = "Select CentreId from centre where CentreName=?";
		$parameters=array($centreName);
		$res=$sqlDBManager->queryRow($sql,$parameters);

		if(!empty($res)){
			$centreId = $res['CentreId'];
		}

		$sql = "Select * from Tracking where Date<? and CentreId=?";
		$parameters=array($today,$centreId);
		$res=$sqlDBManager->queryRows($sql,$parameters);

		if(!empty($res)){
			for($i=0;$i<count($res);$i++){
				if ($res[$i]['Status'] != 'Exported') {
					$flag=1;
					break;
				}
			}
			
		}
		
	}
	echo $flag;
?>